// 组件样式

// 按钮组件样式
.btn {
  @include button-style(#409eff);

  &.btn-secondary {
    @include button-style(#909399);
  }

  &.btn-success {
    @include button-style(#67c23a);
  }

  &.btn-warning {
    @include button-style(#e6a23c);
  }

  &.btn-danger {
    @include button-style(#f56c6c);
  }
  
  &.btn-outline {
    background: transparent;
    color: var(--el-color-primary);
    border: 1px solid var(--el-color-primary);
    
    &:hover {
      background: var(--el-color-primary);
      color: white;
    }
  }
  
  &.btn-ghost {
    background: transparent;
    color: var(--el-color-primary);
    border: none;
    
    &:hover {
      background: rgba(var(--el-color-primary), 0.1);
    }
  }
  
  &.btn-link {
    background: transparent;
    color: var(--el-color-primary);
    border: none;
    text-decoration: underline;
    
    &:hover {
      color: var(--el-color-primary-light-3);
    }
  }
}

// 卡片组件样式
.card {
  @include card-style();
  
  &.card-hover {
    transition: all 0.3s ease;
    
    &:hover {
      transform: translateY(-4px);
      @include shadow('dark');
    }
  }
  
  &.card-bordered {
    border: 1px solid var(--el-border-color);
  }
  
  &.card-shadow-none {
    box-shadow: none;
  }
  
  .card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--el-border-color-lighter);
    
    .card-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--el-text-color-primary);
      margin: 0;
    }
    
    .card-subtitle {
      font-size: 14px;
      color: var(--el-text-color-secondary);
      margin: 4px 0 0 0;
    }
  }
  
  .card-body {
    padding: 20px;
  }
  
  .card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--el-border-color-lighter);
    background: var(--el-bg-color-page);
  }
}

// 输入框组件样式
.input {
  @include input-style();
  
  &.input-large {
    padding: 12px 16px;
    font-size: 16px;
  }
  
  &.input-small {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  &.input-error {
    border-color: var(--el-color-danger);
    
    &:focus {
      border-color: var(--el-color-danger);
      box-shadow: 0 0 0 2px rgba(var(--el-color-danger), 0.2);
    }
  }
  
  &.input-success {
    border-color: var(--el-color-success);
    
    &:focus {
      border-color: var(--el-color-success);
      box-shadow: 0 0 0 2px rgba(var(--el-color-success), 0.2);
    }
  }
}

// 标签组件样式
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  background: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
  border: 1px solid var(--el-color-primary-light-8);
  
  &.tag-success {
    background: var(--el-color-success-light-9);
    color: var(--el-color-success);
    border-color: var(--el-color-success-light-8);
  }
  
  &.tag-warning {
    background: var(--el-color-warning-light-9);
    color: var(--el-color-warning);
    border-color: var(--el-color-warning-light-8);
  }
  
  &.tag-danger {
    background: var(--el-color-danger-light-9);
    color: var(--el-color-danger);
    border-color: var(--el-color-danger-light-8);
  }
  
  &.tag-info {
    background: var(--el-color-info-light-9);
    color: var(--el-color-info);
    border-color: var(--el-color-info-light-8);
  }
  
  &.tag-large {
    padding: 6px 12px;
    font-size: 14px;
  }
  
  &.tag-small {
    padding: 2px 6px;
    font-size: 11px;
  }
  
  &.tag-closable {
    padding-right: 4px;
    
    .tag-close {
      margin-left: 4px;
      cursor: pointer;
      opacity: 0.7;
      
      &:hover {
        opacity: 1;
      }
    }
  }
}

// 徽章组件样式
.badge {
  position: relative;
  display: inline-block;
  
  .badge-content {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    background: var(--el-color-danger);
    color: white;
    border-radius: 8px;
    
    &.badge-dot {
      width: 8px;
      height: 8px;
      min-width: 8px;
      padding: 0;
      border-radius: 50%;
      top: -4px;
      right: -4px;
    }
  }
}

// 头像组件样式
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--el-color-primary-light-9);
  color: var(--el-color-primary);
  font-weight: 500;
  overflow: hidden;
  
  &.avatar-large {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }
  
  &.avatar-small {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  &.avatar-square {
    border-radius: 4px;
  }
  
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

// 分割线组件样式
.divider {
  border: none;
  height: 1px;
  background: var(--el-border-color);
  margin: 16px 0;
  
  &.divider-vertical {
    width: 1px;
    height: auto;
    margin: 0 16px;
    display: inline-block;
    vertical-align: middle;
  }
  
  &.divider-dashed {
    background: none;
    border-top: 1px dashed var(--el-border-color);
  }
  
  &.divider-text {
    position: relative;
    text-align: center;
    background: none;
    
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--el-border-color);
    }
    
    .divider-inner-text {
      display: inline-block;
      padding: 0 16px;
      background: var(--el-bg-color);
      color: var(--el-text-color-secondary);
      font-size: 14px;
      position: relative;
      z-index: 1;
    }
  }
}

// 加载组件样式
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  
  &.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
  }
  
  .loading-spinner {
    @include loading-animation();
  }
  
  .loading-text {
    margin-left: 8px;
    color: var(--el-text-color-secondary);
  }
}

// 空状态组件样式
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  
  .empty-image {
    margin-bottom: 16px;
    opacity: 0.6;
    
    img {
      max-width: 120px;
      max-height: 120px;
    }
  }
  
  .empty-title {
    font-size: 16px;
    color: var(--el-text-color-primary);
    margin-bottom: 8px;
  }
  
  .empty-description {
    font-size: 14px;
    color: var(--el-text-color-secondary);
    margin-bottom: 16px;
  }
  
  .empty-actions {
    display: flex;
    gap: 8px;
  }
}

// 结果组件样式
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  
  .result-icon {
    font-size: 64px;
    margin-bottom: 16px;
    
    &.result-success {
      color: var(--el-color-success);
    }
    
    &.result-warning {
      color: var(--el-color-warning);
    }
    
    &.result-error {
      color: var(--el-color-danger);
    }
    
    &.result-info {
      color: var(--el-color-info);
    }
  }
  
  .result-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--el-text-color-primary);
    margin-bottom: 8px;
  }
  
  .result-subtitle {
    font-size: 14px;
    color: var(--el-text-color-secondary);
    margin-bottom: 24px;
  }
  
  .result-actions {
    display: flex;
    gap: 12px;
  }
}

// 统计卡片样式
.stat-card {
  @include card-style();
  text-align: center;
  
  .stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--el-color-primary);
  }
  
  .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--el-text-color-primary);
    margin-bottom: 4px;
  }
  
  .stat-label {
    font-size: 14px;
    color: var(--el-text-color-secondary);
  }
  
  .stat-trend {
    margin-top: 8px;
    font-size: 12px;
    
    &.trend-up {
      color: var(--el-color-success);
    }
    
    &.trend-down {
      color: var(--el-color-danger);
    }
  }
}

// 进度条样式
.progress {
  width: 100%;
  height: 8px;
  background: var(--el-border-color-lighter);
  border-radius: 4px;
  overflow: hidden;
  
  .progress-bar {
    height: 100%;
    background: var(--el-color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    
    &.progress-success {
      background: var(--el-color-success);
    }
    
    &.progress-warning {
      background: var(--el-color-warning);
    }
    
    &.progress-danger {
      background: var(--el-color-danger);
    }
  }
  
  &.progress-large {
    height: 12px;
  }
  
  &.progress-small {
    height: 4px;
  }
}
